package ca.concordia.soen6011.tests;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import ca.concordia.soen6011.Result;
import ca.concordia.soen6011.exceptions.InfinityOutputException;
import ca.concordia.soen6011.exceptions.UndefinedOutputException;
import ca.concordia.soen6011.impl.Cos;
import ca.concordia.soen6011.impl.Tan;
import ca.concordia.soen6011.interfaces.MathFunction;


public class TestTan {
	
	private  MathFunction f;

	@Before
	public void setUp(){
		f = new Tan();
	}
	
	@Test
	public void doTest(){
		
		Result r = new Result();
		try
		{
		r = f.compute(60, 2);
		assertEquals(1.73, r.getOutput(), r.getPrecision());
		
		r = f.compute(60, 2);
		assertEquals(1.736565, r.getOutput(), r.getPrecision());
		
		r = f.compute(Math.E,1);		
		assertEquals(0.09, r.getOutput(), r.getPrecision());
		
		r = f.compute(101.43,3);		
		assertEquals(-4.946, r.getOutput(), r.getPrecision());
		
		r = f.compute(-160.2,2);		
		assertEquals(0.36, r.getOutput(), r.getPrecision());
		
		r = f.compute(-230,3);		
		assertEquals(-1.192, r.getOutput(), r.getPrecision());
		
		} catch (InfinityOutputException | UndefinedOutputException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}

}
